package shujvjiegou.week6;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class Queue_do {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int count = scan.nextInt();
        Stack<Integer> stack = new Stack<>();
        Queue<Integer> queue = new LinkedList<>();
        for (int i = 0; i < count; i++) {
            stack.push(scan.nextInt());
        }
        for (int i = 0; i < count; i++) {
            queue.add(stack.pop());
            System.out.print(queue.poll() + " ");
        }
    }
}
